import React, { Component } from 'react'
import Show from './show'
import Video from './video'
export default class ManageRtmp extends Component {
    state = {
        style: "list",
        stream_name:'',
        user_id:'',
        user_name:''
    };    
    change_stream = (value)=>{
        this.setState({
            stream_name:value
        })
    }
    info_stream = (value) => {
        console.log(value)
        const {user_id,user_name} = value
        // console.log(stream_name,time1,time2)
        this.setState({
            user_id,
            user_name
        })
    }
    switchs = (value) => {
        this.setState({style:value})
    }
    render() {
        const {user_id,user_name} = this.state
        return (
            <div>{
                this.state.style === 'list'
                ?<Show switchForm={this.switchs} stream_name={this.change_stream} stream_info={this.info_stream}></Show>
                :<Video switchForm={this.switchs} stream_name={this.state.stream_name} stream_info={{user_id,user_name}}></Video>
                }
                

            </div>
        )
    }
}
